pip install esptool -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install adafruit-ampy -i https://pypi.tuna.tsinghua.edu.cn/simple


::进入当前目脚本目录
cd /d %~dp0

::查找是否有esptool安装成功
@echo off
set  findcmd=esptool.py.exe
for %%I in ( %findcmd% ) do IF EXIST %%~$PATH:I ( echo %%~$PATH:I&goto end ) ELSE ( echo %%I is not found in PATH!&goto nopyexe )
:nopyexe
@echo off
set findcmd=esptool.exe
for %%I in ( %findcmd% ) do IF EXIST %%~$PATH:I ( echo %%~$PATH:I&goto end ) ELSE ( echo %%I is not found in PATH!&goto noexe )
:noexe
echo "not find esptool"
pause
exit /b "erro not find esptool.exe or esptool.py.exe"
:end

%findcmd% -b 115200 erase_flash

%findcmd% --chip esp32 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader_dio_80m.bin 0x10000 webtouch_esp32.ino.bin 0x8000 webtouch_esp32.ino.partitions.bin 

::重启设备
%findcmd% run
